import base64
from lastfmapi import LastFmApi

def main():
    scrobbler = InitScrobbler()
    
    scrobbler.GetInfo()
    scrobbler.ScrobbleTrack({"artist" : "TestArtist",
                             "track" : "TestTrack"})
#    scrobbler.GetRecentTracks()
    
def InitScrobbler():
    keyfile = open("/usr/local/etc/apikey.txt")
    namefile = open("./uinfo.txt")
    scrobbler = LastFmApi(keyfile.readline().strip(), keyfile.readline().strip(),
                          base64.b64decode(namefile.readline().strip()),
                          base64.b64decode(namefile.readline().strip()))

    keyfile.close()
    namefile.close()
    
    return scrobbler
    
if __name__ == "__main__":
    main()
    